package com.loong.coupon.controller.forehead;

import com.loong.common.mvc.BaseForeheadController;
import com.loong.common.rest.Result;
import com.loong.coupon.common.forehead.param.UserCouponQueryForeheadParam;
import com.loong.coupon.handler.UserCouponHandler;
import com.loong.global.dto.UserDTO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description: 处理前台用户优惠券相关请求的controller
 * @Author: LiuQun
 * @Date: 2021/1/8 9:10
 */
@RestController
@RequestMapping("forehead/order/userCoupon")
public class UserCouponController extends BaseForeheadController {

    @Resource
    private UserCouponHandler userCouponHandler;

    //用户一登录就接收平台赠送的优惠券
    public Result getPlatformGift(){
        UserDTO userDTO = super.getUserDTO();
        return handlerExecutor.execute(() -> userCouponHandler.foreheadSaveUserCoupon(userDTO));
    }


    /***
     * 分页查询用户优惠券
     * @param param
     * @return
     */
//    @PostMapping("pageQuery/userCoupon")
//    public Result pageQueryUserCoupon(@RequestBody UserCouponQueryForeheadParam param){
//        Long userId = super.getUserDTO().getId();
//        param.setUserId(userId);
//        return handlerExecutor.execute(() -> );
//    }

}
